package com.jf3q.common.service.impl;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jf3q.common.domain.EduComment;
import com.jf3q.common.mapper.EduCommentMapper;
import com.jf3q.common.service.EduCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 *
 */
@Service
public class EduCommentServiceImpl extends ServiceImpl<EduCommentMapper, EduComment>
    implements EduCommentService {
    @Autowired
    EduCommentMapper commentMapper;

    @Override
    public Page<EduComment> getMyComment(String title, String content, String memberId, String orderType, Page<EduComment> page) {
        if ("asc".equals(orderType) || "desc".equals(orderType)) {
            // 如果 orderBy 参数是 ASC 或 DESC，则使用 orderBy 参数，否则默认按照数据库中的顺序排序
            return commentMapper.getMyComment(title, content,memberId, orderType , page);
        } else {
            return commentMapper.getMyComment(title, content, memberId, orderType, page);
        }
    }

    @Override
    public EduComment getComment(String id) {
        return commentMapper.getComment(id);
    }
}




